#pragma once
#include "IBaseInterface.h"
#include "..\Messaging\IListener.h"


enum { OBJ_BASE, OBJ_PLAYER = 0, OBJ_ENEMY, OBJ_PROJECTILE, OBJ_UNIT, OBJ_BOSS, OBJ_MINI_BOSS };

class CBase : public IBaseInterface , public IListener
{
private:

	float m_fPosX, m_fPosY;
	float m_fVelX, m_fVelY;
	int m_nImageID;
	unsigned int m_unRefCount;
	int m_nWidth, m_nHeight;
	bool m_bIsActive;
	bool m_isRight;

protected:
	int m_nType;

public:
	CBase();
	~CBase();

	// Accessors
	float GetPosX() const { return m_fPosX; }
	float GetPosY() const { return m_fPosY; }
	float GetVelX() const { return m_fVelX; }
	float GetVelY() const { return m_fVelY; }
	int GetWidth() const { return m_nWidth; }
	int GetHeight() const { return m_nHeight; }
	int GetImageID() const { return m_nImageID; }
	unsigned int GetRefenceCount() { return m_unRefCount; }
	bool GetIsActive() const { return m_bIsActive; }
	bool GetRight() { return m_isRight; }

	// Mutator
	void SetPosX(float _fPosX) { m_fPosX = _fPosX; }
	void SetPosY(float _fPosY) { m_fPosY = _fPosY; }
	void SetVelX(float _fVelX) { m_fVelX = _fVelX; }
	void SetVelY(float _fVelY) { m_fVelY = _fVelY; }
	void SetWidth(int _nWidth) { m_nWidth = _nWidth; }
	void SetHeight(int _nHeight) { m_nHeight = _nHeight; }
	void SetImageID(int _nImageID) { m_nImageID = _nImageID; }
	void SetIsActive(bool _bIsActive) { m_bIsActive = _bIsActive; }
	void SetRight( bool _isRight ) { m_isRight = _isRight; }

	void HandleEvent(CEvent* pEvent);

	// Gameplay Functions
	virtual void Update(float _fDT);
	virtual void Render();

	virtual void AddRef() { m_unRefCount++; }
	virtual void Release();

	virtual int GetType() { return m_nType; }

	virtual RECT GetCollisionRect();

	virtual bool CheckCollision(IBaseInterface* pBase);
};